#include <iostream>
#include <format>

struct Vector3 {
	float x;
	float y;
	float z;

	std::ostream& operator << (std::ostream& Out) {
		Out << std::format("[{},{}, {z}]", x, y, z);
		return Out;
	}

	float operator *(const Vector3& In) {
		return x * In.x + y * In.y + z * In.z;
	}
	Vector3 operator *(float In) {
		return Vector3(x * In, y * In, z * In);
	}
	Vector3 operator +=(const Vector3& In) {
		return Vector3(x + In.x, y + In.y, z + In.z);
	}
	Vector3 operator -=(const Vector3& In) {
		return Vector3(x - In.x, y - In.y, z - In.z);
	}

	friend Vector3 Dot(const Vector3& Lth, const Vector3& Rth);
	friend Vector3 operator* (float Lth, const Vector3& Rth);
	friend std::ostream& operator << (std::ostream& Out, const Vector3& Vec);
};

Vector3 Dot(const Vector3& Lth, const Vector3& Rth)
{
	return Vector3(Lth.y * Rth.z - Lth.z * Rth.y, Lth.z * Rth.x - Lth.x * Rth.z, Lth.x * Rth.y - Lth.y * Rth.x);
}

Vector3 operator*(float Lth, const Vector3& Rth)
{
	return Vector3(Lth * Rth.x, Lth * Rth.y, Lth * Rth.z);
}

std::ostream& operator<<(std::ostream& Out, const Vector3& Vec)
{
	Out << std::format("[{},{}, {}]", Vec.x, Vec.y, Vec.z);
	return Out;
}
